<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" href="http://localhost:3000/admin/plugins/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="http://localhost:3000/admin/css/main.css" />

</head>

<body>
<div style="margin: 15px;">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>添加新招聘</legend>
	</fieldset>

	<form class="layui-form" action="">
		<div class="layui-form-item">
			<label class="layui-form-label">姓名</label>
			<div class="layui-input-block">
				<input type="text" id="name" name="name"  autocomplete="off" placeholder="请输入姓名" class="layui-input">
			</div>
		</div>


		<div class="layui-form-item">
			<label class="layui-form-label">离职时间</label>
			<div class="layui-input-block">
				<input type="text" id="time" name="time" id="date"  placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
			</div>
		</div>


		<div class="layui-form-item">
			<label class="layui-form-label">部门</label>
			<div class="layui-input-block">
				<input type="text" id="department" name="department"  autocomplete="off" placeholder="请输入部门" class="layui-input">
			</div>
		</div>




		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" id="add">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript" src="http://localhost:3000/admin/plugins/layui/layui.js"></script>
<script>
	layui.use(['form', 'laydate','upload'], function() {
		var form = layui.form(),
				layer = layui.layer,
				laydate = layui.laydate,
				$= layui.jquery;


		//监听提交
		//点击添加分类
		$('#add').on('click', function() {
			var name=$("#name").val();
			var time=$("#time").val();
			var department=$("#department").val();
			//测试用户是否录入信息
			if(name==""||time==""||department==""){
				layer.alert('请填入相关信息', {icon: 2});
				return;
			}
			$.post("http://localhost:3000/admin/add_quit",{name:name,time:time,department:department},function(result){
				if(result.status==="success"){
					layer.alert('添加成功,请在离职公示列表查看。', {icon: 1});
				}else{
					layer.alert('添加失败', {icon: 2});
				}
			});
			//这句话的意思不会刷新当前页面。避免清空内容
			return false;
		});
	});
</script>
</body>

</html>